<template>
  <view class="webview-container">
    <text>{{ url }}</text>
      <web-view :src="url" />
  </view>
</template>

<script setup>
import { onMounted, ref } from 'vue'
import Taro from '@tarojs/taro'

Taro.setNavigationBarColor({
  frontColor: "#000000",
  backgroundColor: '#F7F3E8'
})

const url = ref('')
const title = ref('')

// 获取传递进来的 url 参数
onMounted(() => {
  
  const { url: externalUrl } = Taro.getCurrentInstance().router.params
  const { title: externalTitle } = Taro.getCurrentInstance().router.params
  url.value = decodeURIComponent(externalUrl)
  title.value = decodeURIComponent(externalTitle)
  Taro.setNavigationBarTitle({
    title: title.value
  })
})
</script>

<style scoped>
.webview-container {
  height: 100vh;
  width: 100%;
  background-color: #F7F3E8;
}
</style>